package com.game.demo409.demo409;

import android.app.Activity;
import android.graphics.Paint;
import android.os.Bundle;


import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.rengwuxian.materialedittext.MaterialEditText;

import widget.CheckBox;


public class SignUpActivity extends Activity {
    private MaterialEditText mSignUp_username;
    private  MaterialEditText mSignUp_email;
    private MaterialEditText mSignUp_pwd;
    private MaterialEditText mSignUp_pwdAgain;
    private RadioGroup mSexGroup;
    private Button mJoin;
    private CheckBox mCheckAgreement;
    private TextView mTvAgreement;
   private static final int USERNAME_MAX = 12;
    private static final int USERNAME_MIN = 3;
    private static final int PASSWORD_MAX = 20;
    private static final int PASSWORD_MIN = 8;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_up);
        mSignUp_username = (MaterialEditText) findViewById(R.id.sinup_username);
        mSignUp_email = (MaterialEditText) findViewById(R.id.sinup_email);
        mSignUp_pwd = (MaterialEditText)findViewById(R.id.sinup_pwd);
        mSignUp_pwdAgain = (MaterialEditText)findViewById(R.id.sinup_pwd_again);

        mSexGroup = (RadioGroup)findViewById(R.id.sex_group);
        mJoin = (Button)findViewById(R.id.btnJoin);
        mCheckAgreement = (CheckBox)findViewById(R.id.check_agreementr);
        mTvAgreement = (TextView) findViewById(R.id.tv_agreement);
        mTvAgreement.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);//下划线


        mSignUp_username.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                //TODO
                //输入后判断合法性
            }
        });

        mSignUp_email.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if(!hasFocus) {
                   //输入后判断合法性
                }
            }
        });

        mSignUp_pwd.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                //TODO
                //输入后判断合法性
            }
        });

        mSignUp_pwdAgain.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                //TODO
                //输入后判断合法性
            }
        });
    }

}
